﻿using shenghua.Order.Orders.Median;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace shenghua.Commodity.Commodities.Dto
{
    public class CommodityCollectionDto
    {
        public bool HasCoupon { get; set; }
        public string CouponName { get; set; }
        public double CouponAmount { get; set; }
        public int UsedXPValue { get; private set; }
        public double XPAmount { get; private set; }
        public int BounsXPValue { get; set; }
        public double TotalAmount { get; set; }
        public int TotalCount { get; set; }
        public double CommodityTotalAmount { get; set; }
        public List<CommodityCollectionItemDto> Items { get; set; }

        public CommodityCollectionDto(CommodityCollection input)
        {
            HasCoupon = input.HasCoupon;
            CouponName = input.CouponName;
            CouponAmount = input.CouponAmount;
            UsedXPValue = input.UsedXPValue;
            XPAmount = input.XPAmount;
            BounsXPValue = input.BounsXPValue;
            TotalAmount = input.TotalAmount;
            TotalCount = input.TotalCount;
            CommodityTotalAmount = input.SumedTotalAmount;

            Items = new List<CommodityCollectionItemDto>();
            foreach(var item in input.Items)
            {
                Items.Add(new CommodityCollectionItemDto(item));
            }
        }
    }

}
